import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import AutoImport from 'unplugin-auto-import/vite'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [
        ElementPlusResolver({
          importStyle: false
        })
      ]
    }),
    AutoImport({
      imports: ['vue']
    })
  ],
  server: {
    host: true,
    port: 3000,
    open: true,
    cors: true,
  },
  resolve: {
    extensions: ['.ts', '.vue', '.js', '.json'],
    alias: {
      '@': resolve(__dirname, 'src'),
    }
  }
})
